package com.chinasofti.manager.service.impl;

import com.alibaba.dubbo.config.annotation.Service;
import com.chinasofti.dao.AdminRepository;
import com.chinasofti.manager.service.AdminService;
import com.chinasofti.model.Admin;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

/**
 * Creator: <br>
 * Date: <br>
 * Description: <br>
 */
@Service
@Component
public class AdminServiceImpl implements AdminService {
    @Autowired
    private AdminRepository adminRepository;

    @Override
    public boolean login(String username, String password) {
        Admin admin = adminRepository.findByUsername(username);
        if (admin == null){
            return false;
        }
        if (admin.getPassword().equals(password)){
            return true;
        }else {
            return false;
        }
    }

}
